package main

import (
	"context"
	"github.com/zeromicro/go-zero/core/conf"
	"github.com/zeromicro/go-zero/zrpc"
	"gozero-learn/grpc-server/greet"
	"log"
)

func main() {
	var clientConf zrpc.RpcClientConf
	conf.MustLoad("grpc-client/ect/client.yaml", &clientConf)
	conn := zrpc.MustNewClient(clientConf)
	client := greet.NewGreetClient(conn.Conn())
	rsp, err := client.Ping(context.Background(), &greet.Request{Ping: "Ping"})
	if err != nil {
		log.Fatal(err)
		return
	}
	log.Println(rsp)
	//var clientConf zrpc.RpcClientConf
	//conf.MustLoad("grpc-client/ect/client.yaml", &clientConf)
	//conn, err := grpc.Dial(clientConf.Target, grpc.WithTransportCredentials(insecure.NewCredentials()))
	//if err != nil {
	//	log.Fatal(err)
	//}
	//client := greet.NewGreetClient(conn)
	//rsp, err := client.Ping(context.Background(), &greet.Request{Ping: "Ping"})
	//if err != nil {
	//	log.Fatal(err)
	//	return
	//}
	//log.Println(rsp)
}
